<?php
namespace app\api\validate;

use app\common\logic\SmsLogic;
use think\Db;
use think\validate;

class FeiHong extends Validate
{
    protected $regex = ['password' => '^(?=.*[a-zA-Z0-9].*)(?=.*[a-zA-Z\\W].*)(?=.*[0-9\\W].*).{6,20}$'];
    protected $rule = [
        'mobile' => 'require|mobile',
        'name' => 'require',
        'address' => 'require',
        'address_detail' => 'require',
        'verify_code' => 'require',
        'goods_id' => 'require',
        'card' => 'require|idCard',
        'consignee' => 'require',
        'order_id' => 'require',
        'displace_or_add' => 'require',
    ];

    protected $message = [
        'mobile.require'    => '请输入手机号',
        'mobile.mobile'     => '非有效手机号码',
        'name.require'     => '请输入真实姓名',
        'address.require'     => '请选择所在位置',
        'address_detail.require'     => '请填写详细地址',
        'verify_code.require'     => '验证码不能为空',
        'goods_id.require'     => '商品ID不能为空',
        'card.require'     => '身份证号必填',
        'card.idCard'     => '非有效身份证号',
        'order_id.require'     => '订单ID必须',
        'displace_or_add.require'     => '订气类型不能为空',
    ];


    protected $scene = [
        'res'  =>  ['mobile', 'name', 'address', 'address_detail'],
        'login'  =>  ['mobile', 'verify_code'],
        'booking'  =>  ['goods_id'],
        'management'  =>  ['mobile', 'name', 'address', 'card'],
        'info'  =>  ['name'],
        'order'  =>  ['consignee', 'address', 'mobile', 'displace_or_add'],
        'detail'  =>  ['order_id'],
    ];
}
